using System;
using System.Collections;


namespace Deepcode.Flux.Core.Collections
{
	/// <summary>
	/// Special class identitcal to Deepcode.Flux.Collections.SessionDictionary, but implementing
	/// the GetConnectionString() function.
	/// </summary>
	public class SetupDictionarySession : Deepcode.Flux.Core.Collections.SessionDictionary
	{
		/// <summary>
		/// Returns the connection string based upon the various
		/// key/values entered in the setup. Used only by Flux.NET 
		/// initial setup.
		/// </summary>
		/// <param name="WithDatabase"></param>
		/// <returns></returns>
		public static string GetConnectionString( bool WithDatabase )
		{
			string ServerString = "";
			ServerString += "server=" + Config["SQLServer"] + ";";
			if( Config["SQLAuthMode"] == "WINDOWS" ) ServerString += "trusted_connection=yes;";
			if( Config["SQLAuthMode"] == "SQL" )
				ServerString += "user=" + Config["SQLServerUsername"] + ";pwd=" + Config["SQLServerPassword"] + ";";
			if( WithDatabase )
				ServerString += "database=" + Config["SQLServerDatabase"] + ";";
			ServerString += "Language=British;";
			return ServerString;
		}
	}
}
